package com.webSite.demo.cy.ocr;

import java.util.HashMap;

import org.json.JSONObject;

import com.baidu.aip.ocr.AipOcr;

public class OcrTest {

	//设置APPID/AK/SK
    public static final String APP_ID = "11777587";
    public static final String API_KEY = "CdqdZnO6LM5WBqsmYODBhMWq";
    public static final String SECRET_KEY = "Zl64A38Wd5qwVBHWIDGxRiRGlCLDZ31S";

    public static void main(String[] args) {
        // 初始化一个AipOcr
        AipOcr client = new AipOcr(APP_ID, API_KEY, SECRET_KEY);

        // 可选：设置网络连接参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);

        // 调用接口
        String path = "C:\\Users\\yanfa00027\\Desktop\\111\\2.jpg";
        JSONObject res = client.basicGeneral(path, new HashMap<String, String>());
        System.out.println(res.toString(2));
        
    }
}
